package com.hotel.customersystem.mapper;

import com.mysql.cj.jdbc.MysqlDataSource;
import org.apache.mahout.cf.taste.impl.model.jdbc.MySQLJDBCDataModel;
import org.apache.mahout.cf.taste.model.DataModel;
import org.apache.mahout.cf.taste.model.JDBCDataModel;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;


@Component
public class DataConfig {

    @Bean
    public DataModel getMySQlDataModel(){
        MysqlDataSource dataSource = new MysqlDataSource();
//        dataSource.setServerName("192.168.186.82");
        dataSource.setServerName("192.168.186.88");
        dataSource.setUser("root");
        dataSource.setPassword("123456");
        dataSource.setDatabaseName("hotel_system");
        //                                                数据源     表名                      用户id                酒店编号                    偏好值                     偏好时间
        JDBCDataModel dataModel = new MySQLJDBCDataModel(dataSource,"pianhao","user_id","hotel_id","pianhao_value","pianhao_time");
        return  dataModel;
    }
}
